package com.fy.springcloud;

import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.cloud.netflix.eureka.server.EnableEurekaServer;

//Eureka Server增加security安全配置：
//1.在Eureka Server服务端引入security，并添加配置：
//eureka:
//  instance:
//    hostname: localhost
//  client:
//    register-with-eureka: false
//    fetch-registry: false
//    service-url:
//      defaultZone: http://admin:admin@localhost:8761/eureka/
//
//spring:
//  application:
//    name: eureka-server
//  security:
//    user:
//      name: admin
//      password: admin
//
//		<dependency>
//            <groupId>org.springframework.boot</groupId>
//            <artifactId>spring-boot-starter-security</artifactId>
//        </dependency>
//
//还需要增加一个security的csrf配置类(没有这个类，在客户端注册时会提示未知的服务器)
//@Configuration
//public class SecurityConfig extends WebSecurityConfigurerAdapter {
//
//    @Override
//    protected void configure(HttpSecurity http) throws Exception {
//        http.csrf().disable();
//        super.configure(http);
//    }
//}
//
//2.在Eureka客户端增加配置
//eureka:
//  instance:
//    prefer-ip-address: true
//  client:
//    service-url:
//      defaultZone: http://admin:admin@localhost:8761/eureka/
//
@EnableEurekaServer
@SpringBootApplication
public class EurekaApplication {
    public static void main(String[] args) {
        SpringApplication.run(EurekaApplication.class, args);
    }
}
